package com.zyk.scaffold.oauth.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class AppInfoDTO implements Serializable {
    private static final long serialVersionUID = 3384804456883058316L;

    /**
     * appId
     */
    private String appId;

    /**
     * appName
     */
    private String appName;

    /**
     * tenantCode
     */
    private String tenantCode;

    /**
     * tenantName
     */
    private String tenantName;
    /**
     * appKey
     */
    private String appKey;

    /**
     * 限流
     */
    private List<Limit> limits;

    /**
     * 时间校验开关
     */
    private Boolean enableTimeOut = Boolean.TRUE;

    /**
     * 超时时间
     */
    private Long timeout = 6000L;

    /**
     * 时间偏移
     */
    private Long timeoffset = 0L;

    /**
     * URL列表
     */
    private List<String> uris = new ArrayList<>();

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppKey() {
        return appKey;
    }

    public void setAppKey(String appKey) {
        this.appKey = appKey;
    }

    public List<Limit> getLimits() {
        return limits;
    }

    public void setLimits(List<Limit> limits) {
        this.limits = limits;
    }

    public Long getTimeoffset() {
        return timeoffset;
    }

    public void setTimeoffset(Long timeoffset) {
        this.timeoffset = timeoffset;
    }

    public Long getTimeout() {
        return timeout;
    }

    public void setTimeout(Long timeout) {
        this.timeout = timeout;
    }

    public List<String> getUris() {
        return uris;
    }

    public void setUris(List<String> uris) {
        this.uris = uris;
    }

    public String getAppName() {
        return appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public String getTenantCode() {
        return tenantCode;
    }

    public void setTenantCode(String tenantCode) {
        this.tenantCode = tenantCode;
    }

    public String getTenantName() {
        return tenantName;
    }

    public void setTenantName(String tenantName) {
        this.tenantName = tenantName;
    }

    public Boolean getEnableTimeOut() {
        return enableTimeOut;
    }

    public void setEnableTimeOut(Boolean enableTimeOut) {
        this.enableTimeOut = enableTimeOut;
    }


    public static class Limit implements Serializable {
        private static final long serialVersionUID = 3384804456883058319L;

        /**
         * 匹配规则
         */
        private String matching = "/**";

        /**
         * 时间窗
         */
        private int timeWindow = 60;

        /**
         * 时间窗允许的次数
         * 0:截止状态
         * -1:失效状态
         * 大于0正常状态
         */
        private int frequency = -1;

        public String getMatching() {
            return matching;
        }

        public void setMatching(String matching) {
            this.matching = matching;
        }

        public int getTimeWindow() {
            return timeWindow;
        }

        public void setTimeWindow(int timeWindow) {
            this.timeWindow = timeWindow;
        }

        public int getFrequency() {
            return frequency;
        }

        public void setFrequency(int frequency) {
            this.frequency = frequency;
        }
    }
}
